package org.brownflat.watergate.web;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * <p>&copy Rupert Jones 2012</p>
 *
 * @author rup
 */
public class WebSessionSessionContextProvider {

    public String getCurrentUser() {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (authentication != null) {
            return (String) authentication.getPrincipal();
        } else {
            return null;
        }
    }
}
